package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.AlarmRuleMapper;
import com.ruoyi.system.domain.AlarmRule;
import com.ruoyi.system.service.IAlarmRuleService;
import com.ruoyi.common.core.text.Convert;

/**
 * 预警规则管理信息Service业务层处理
 * 
 * @author zbb
 * @date 2023-02-15
 */
@Service
public class AlarmRuleServiceImpl implements IAlarmRuleService 
{
    @Autowired
    private AlarmRuleMapper alarmRuleMapper;

    /**
     * 查询预警规则管理信息
     * 
     * @param ruleId 预警规则管理信息主键
     * @return 预警规则管理信息
     */
    @Override
    public AlarmRule selectAlarmRuleByRuleId(Long ruleId)
    {
        return alarmRuleMapper.selectAlarmRuleByRuleId(ruleId);
    }

    /**
     * 查询预警规则管理信息列表
     * 
     * @param alarmRule 预警规则管理信息
     * @return 预警规则管理信息
     */
    @Override
    public List<AlarmRule> selectAlarmRuleList(AlarmRule alarmRule)
    {
        return alarmRuleMapper.selectAlarmRuleList(alarmRule);
    }

    /**
     * 新增预警规则管理信息
     * 
     * @param alarmRule 预警规则管理信息
     * @return 结果
     */
    @Override
    public int insertAlarmRule(AlarmRule alarmRule)
    {
        alarmRule.setCreateTime(DateUtils.getNowDate());
        return alarmRuleMapper.insertAlarmRule(alarmRule);
    }

    /**
     * 修改预警规则管理信息
     * 
     * @param alarmRule 预警规则管理信息
     * @return 结果
     */
    @Override
    public int updateAlarmRule(AlarmRule alarmRule)
    {
        alarmRule.setUpdateTime(DateUtils.getNowDate());
        return alarmRuleMapper.updateAlarmRule(alarmRule);
    }

    /**
     * 批量删除预警规则管理信息
     * 
     * @param ruleIds 需要删除的预警规则管理信息主键
     * @return 结果
     */
    @Override
    public int deleteAlarmRuleByRuleIds(String ruleIds)
    {
        return alarmRuleMapper.deleteAlarmRuleByRuleIds(Convert.toStrArray(ruleIds));
    }

    /**
     * 删除预警规则管理信息信息
     * 
     * @param ruleId 预警规则管理信息主键
     * @return 结果
     */
    @Override
    public int deleteAlarmRuleByRuleId(Long ruleId)
    {
        return alarmRuleMapper.deleteAlarmRuleByRuleId(ruleId);
    }
}
